package com.example.springcloudseata.service.impl;

import com.example.springcloudseata.fegin.DeptServiceFegin;
import com.example.springcloudseata.fegin.UserServiceFegin;
import com.example.springcloudseata.service.UserService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserServiceImpl implements UserService {

    @Resource
    UserServiceFegin userServiceFegin;
    @Resource
    DeptServiceFegin deptServiceFegin;

    @Override
    @GlobalTransactional(name = "xuewei_tx_group",rollbackFor = Exception.class)
    public void add() {
        //用户表添加数据
        userServiceFegin.add();
        //部门表参加数据
        deptServiceFegin.add();
    }
}
